/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package elsimulatorjava;

import java.util.Date;
import java.util.Random;
/**
 *
 * @author jc238592
 */
public class Person {

    private static int peopleCount = 0;
    
    private Date timeFinished;

    private boolean finished = false;
    
    private short floorDest;
    
    private int index;
    
    public Person(short fD){
        this.index = peopleCount++;
        this.floorDest = fD;
    }

    // Functions
    protected void setFloorDest(byte fD) {
        this.floorDest = fD;
    }

	// Getters and setters
    public short getFloorDest() {
        return this.floorDest;
    }
    
    public void setFinished() {
        this.finished = true;
        this.timeFinished = new Date();
    }
    
    public boolean isFinished() {
        return this.finished;
    }
    
    protected int timeSinceFinish(){
        if (isFinished()) {
            return (int)(new Date().getTime()-this.timeFinished.getTime());
        }
        else 
            return 0;
    }
    
    public int getIndex(){
        return this.index;
    }

    void setFromSavedFinished(boolean aBoolean) {
        finished = aBoolean;
    }
  
}
